import 'package:part_time_job_pro/common/utils/def_type.dart';
import 'package:part_time_job_pro/common/utils/request_util.dart';
import 'package:part_time_job_pro/common/values/server_config.dart';

//短信相关
class SmsApi {
  late RequestUtil apiUtil;
  //创建实例
  SmsApi() {
    apiUtil = RequestUtil.getInstance();
  }

  /*
   * 获取短信验证码
   * @param mobile 手机号码
   * @param type 验证码类型 1 短信 2 语音
   */
  sendSmsCode(RequestCallBack requestCallBack, String mobile,
      {String type = "1"}) async {
    try {
      Map<String, dynamic> params = {"type": type, "mobile": mobile};
      var result = await apiUtil.post(HttpConfig.sendSmsCode,
          decode: true, data: params);
      requestCallBack(result);
    } catch (e) {
      requestCallBack(e);
    }
  }
}
